package com.sl.core.engine.utils;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;

public class TidUtil {

    public static String getTid() {
        String tid = IdUtil.fastSimpleUUID();
        return getTid(tid);
    }

    public static String getTid(String prefix) {
        DateTime date = DateUtil.date();
        String dateStr = DateUtil.format(date, DatePattern.PURE_DATE_PATTERN);
        String localhostStr = NetUtil.getLocalhostStr();
        return StrUtil.concat(true, dateStr, "_", localhostStr, "_", prefix);
    }
}
